package entities;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import custom_types.Date;
import custom_types.EmailAddress;

@Entity
@Table(name="Users")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class User {
	@Id
	@Column
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	@Column
	private String username;
	@Column
	private String password;
	@Embedded
	private EmailAddress email;
	@Column
	private String name;
	@Column
	private String surname;
	@Embedded
	private Date registrationDate;
	
	public User(){}

	public User(String username, String password, EmailAddress email, String name, String surname, Date registrationDate) {
		this.username = username;
		this.password = password;
		this.email = email;
		this.name = name;
		this.surname = surname;
		this.registrationDate = registrationDate;
	}

	//Getters
	
	public int getId() { return id; }
	public String getUsername() { return username; }
	public String getPassword() { return password; }
	public String getEmail() { return email.getEmail();}
	public String getName() { return name; }
	public String getSurname() { return surname; }
	public Date getRegistrationDate() { return registrationDate; }
	
	//Setters
	public void setId(int id) { this.id = id; }
	public void setUsername(String username) { this.username = username; }
	public void setPassword(String password) { this.password = password; }
	public void setEmail(EmailAddress email) { this.email = email; }
	public void setName(String name) { this.name = name; }
	public void setSurname(String surname) { this.surname = surname; }
	public void setRegistrationDate(Date registrationDate) { this.registrationDate = registrationDate; }
	
	
}
